home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 128 #10 / q10.d81 / t.128 shell < prev    next >
Encoding:
Text File  |  1990-01-01  |  13.7 KB  |  357 lines

  1.  
  2.                      L O A D S T A R    S H E L L   1 2 8
  3.  
  4.                              by Robert Rockefeller
  5.  
  6.       The LOADSTAR Shell Utility gives C-128 users the ability to execute
  7. machine-language programs by typing the name of the program, as well as a
  8. RAM disk in bank one RAM in which machine-language and BASIC programs can
  9. be loaded.  Included with the shell program are ten useful utility
  10. programs. Utility programs will execute from the RAM disk very quickly
  11. indeed.
  12.  
  13.      The shell program uses memory from address $1300 to address $1b00.
  14. Since BASIC program storage starts at address $1c00, this means the shell
  15. is compatible with normal BASIC programs.  However, BASIC programs which
  16. try to load machine-language, or POKE data to memory being used by the
  17. shell will crash the computer.  In our experience the shell is compatible
  18. with the vast majority of BASIC programs.
  19.  
  20.      The RAM disk starts at the top of RAM bank 1 at address $ff00, and
  21. grows downwards from there. Any RAM which is not being used by the RAM disk
  22. is available to BASIC for storage of strings, variables, and arrays.  The
  23. RAM disk can grow to a maximum size of about 57000 bytes, is protected from
  24. BASIC and cannot be harmed by BASIC programs, except by programs which POKE
  25. data to memory being used by the RAM disk.  However, BASIC programs of this
  26. type are very rare.
  27.  
  28.     All in all the shell program has a very high degree of compatiblity
  29. with BASIC programs, but will almost certainly crash if used with
  30. commercial machine-language programs such as wordprocessors, paint
  31. programs, etc.
  32.  
  33.     The shell possesses a feature which will allow you to re-start the
  34. shell after pressing the RESET button.  This is useful when you have
  35. programs in the RAM disk since you won't have to re-load.  To restart just
  36. execute SYS4870 from BASIC, or G 1306 from the monitor.  The shell computes
  37. its own checksum to verify code integrity, then it will compute the RAM
  38. disk checksums.  If the shell checksum is invalid the shell will not
  39. re-start, and you must RUN"SHELL to re-start.  If any of the programs in
  40. the RAM disk are invalid their names will be listed, and they will be
  41. marked invalid so they can't be loaded.  In addition, you will be given the
  42. opportunity to clear the RAM disk.
  43.  
  44.     Shell utility programs can be loaded into the RAM disk with the LD
  45. utility (see below) then executed by simply typing their names.  BASIC
  46. programs can also be loaded into the RAM disk with LD then RUN by
  47. specifying a device number of 7.  For example, you would type RUN"MAIL
  48. LIST",U7 then type RETURN to execute the program "MAIL LIST".
  49.  
  50.      If you wish to write your own machine-language programs for use with
  51. the shell you must be aware of several things.  First of all the program
  52. filenames must begin with the letters "COM.".  This is necessary so the
  53. shell can distinguish shell programs from other types of files.  Second of
  54. all, the machine-language programs must be assembled to execute at address
  55. $1c03.  Thirdly, shell machine-language programs must terminate with a RTS
  56. instruction, or by JMPing to address $1303.  Last of all, like BASIC
  57. variables, utility names cannot have a BASIC command embedded in it.  For
  58. example the name "COM.DCLR" would be an invalid name because it has the
  59. command CLR in it.
  60.  
  61.     As an example, one of the included shell programs named "COM.DL" will
  62. list a BASIC program on disk.  To execute it you merely need to type the
  63. utility name without the "COM." prefix, plus the name of one or more files
  64. you wish to list.  For example, to list a BASIC program named "FILECOPY"
  65. you would type DL "FILECOPY", then type the RETURN key.  If you have more
  66. than one disk drive you can specify a device number by prefixing it to the
  67. filename.  For example, DL "FILECOPY" 9,"RAMDOS" would list "FILECOPY" from
  68. device 8, and "RAMDOS" from device 9.  Filenames need not be enclosed in
  69. quotes except when they contain a BASIC command.  For example, "FILECOPY"
  70. would need to be enclosed in quotes since it contains the BASIC command
  71. COPY.  "RAMDOS" would not necessarily need to be in quotes since it
  72. contains no BASIC command.  However, as a general rule we recommend that
  73. filenames be enclosed in quotes.
  74.  
  75.     The ten included utility programs are explained below.
  76.  
  77. "COM.TYPE"
  78.  
  79.     TYPE displays disk text files on the screen.  Either normal or screen
  80. code files can be displayed.  Screen code files can be specified by using
  81. the +S switch.  PET ASCII files are the default type, but can be specified
  82. using the -S switch.  Examples:
  83.  
  84. TYPE +S 9,"CODES" -S "TEXT1"
  85.  
  86. This would display a screen code file "CODES" from device 9, then a PET
  87. ASCII file "TEXT1" from device 8.
  88.  
  89. TYPE "LETTER"
  90.  
  91. This would display a PET ASCII file "LETTER" from device 8.
  92.  
  93. "COM.DUMP"
  94.  
  95.     DUMP displays disk files on the screen in both hexadecimal and text
  96. format.  Either normal or screen code files can be displayed.  Screen code
  97. files can be specified by using the +S switch.  PET ASCII files are the
  98. default type, but can be specified by using the -S switch.  Examples:
  99.  
  100. DUMP +S 9,"CODES" -S "TEXT1"
  101.  
  102. This would display a screen code file "CODES" from device 9, then a PET
  103. ASCII file "TEXT1" from device 8.
  104.  
  105. DUMP "LETTER"
  106.  
  107. This would display a PET ASCII file "LETTER" from device 8.
  108.  
  109. "COM.DL"
  110.  
  111.     DL displays BASIC programs from disk on the screen.  Example:
  112.  
  113. DL 9,"DATABASE" "SUBS"
  114.  
  115. This would display a BASIC program "DATABASE" from device 9, then the file
  116. "SUBS" from device 8.
  117.  
  118. "COM.VAR"
  119.  
  120.     VAR displays all defined variables and their values.  This is mostly
  121. useful during BASIC programming.  Example: VAR
  122.  
  123. "COM.ARY"
  124.  
  125.     ARY can do two things.  ARY alone or ARY LIST lists the names and sizes
  126. of all arrays.  ARY followed by an array name will display the array on the
  127. screen.  This is mostly useful during BASIC programming.  Examples:
  128.  
  129. ARY
  130.  
  131. This would display the names and sizes of all arrays.
  132.  
  133. ARY B
  134.  
  135. This would display the floating point array B.
  136.  
  137. ARY CE$
  138.  
  139. This would display the string array CE$
  140.  
  141. "COM.LD"
  142.  
  143.     LD is provided to load files into the bank 1 RAM disk.  Simply follow
  144. the LD command with the names of files you wish loaded.  See "COM.SUBMIT"
  145. also.  An alternative form LD CLR removes the RAM disk from memory.
  146. Examples:
  147.  
  148. LD "COM.DIR"
  149.  
  150. Load "COM.DIR" into the RAM disk
  151.  
  152. LD "COM.TYPE" "COM.DUMP" "COM.DL"
  153.  
  154. Load "COM.TYPE", "COM.DUMP", and "COM.DL" into the RAM disk
  155.  
  156. "COM.DIR"
  157.  
  158.      DIR is provided to display a directory of the files stored in the RAM
  159. disk.  Example:
  160.  
  161. DIR
  162.  
  163. Displays RAM disk directory.
  164.  
  165. "COM.COM"
  166.  
  167.      COM is provided to specify the search order for COM files.  The shell
  168. always checks the RAM disk first.  Normally device 8 is then searched.
  169. However up to three disk devices can be specified to be searched in any
  170. order.  Examples:
  171.  
  172. COM 9 8
  173.  
  174. Specify that device 9 be searched after the RAM disk, then device 8.
  175.  
  176. COM 8 9 10
  177.  
  178. Specify that device 8 be searched after the RAM disk, then device 9, then
  179. device 10.
  180.  
  181. COM 8
  182.  
  183. Specify that device 8 only be searched after the RAM disk.
  184.  
  185. "COM.SUBMIT"
  186.  
  187.      SUBMIT is possibly the most versatile and useful command of all.  It
  188. allows you to execute lists of commands stored on disk just as if they had
  189. been typed at the keyboard.  Literally any command that you can type in can
  190. be executed from a disk file.  SUBMIT is useful when you find yourself
  191. entering the same sequence of commands over and over.  You can enter these
  192. commands into a disk file and type one command to execute the disk file. 
  193. For example, if you fiad yourself regularly using LD to load several
  194. utilities into the RAM disk, ysu can save typing by putting the LD command
  195. in a SUBMIT file.  If each line in a SUBMIT file begins with a line number,
  196. the lines will be merged into the BASIC program text.
  197.  
  198.      SUBMIT works almost exactly like "SUBMIT.COM" does under CP/M for
  199. those familiar with CP/M.  SUBMIT files must have a "SUB." prefix. 
  200. "SUB.LDALL" is an example of a SUBMIT filename.  Follow the SUBMIT command
  201. with the name of the file you wish to execute.  For example, SUBMIT "LDALL"
  202. would execute the file "SUB.LDALL".
  203.  
  204.      You can pass parameters to SUBMIT files when they are executed.  Each
  205. parameter is scanned and a textual substitution takes place.  $1 is
  206. replaced by the first parameter, $2 is replaced by the second parameter,
  207. etc.  Up to 9 parameters may be passed to a SUBMIT file.  For example if a
  208. SUBMIT file "SUB.REN" contained the following lines:
  209.  
  210. SCRATCH "COM.$1"
  211.  
  212. RENAME "BIN.$1" TO "COM.$1"
  213.  
  214. and you entered the following command,
  215.  
  216. SUBMIT REN ARY
  217.  
  218. the word ARY would be substituted in every case for $1 producing:
  219.  
  220. SCRATCH "COM.ARY"
  221.  
  222. RENAME "BIN.ARY" TO "COM.ARY"
  223.  
  224. This is an example of a SUBMIT file that was actually used by the author in
  225. the preparation of these utilities.
  226.  
  227.      If you pass more parameters than called for in the SUBMIT file, the
  228. extra parameters are ignored.  If you pass fewer parameters than called for
  229. in a SUBMIT file, some parameters will be replaced by the null string.  For
  230. example, if we have a SUBMIT file "SUB.AS" containing ASM $1 $2 $3, and we
  231. execute SUBMIT AS DEBUG, this would expand into ASM DEBUG.  The $2 and $3
  232. are replaced with literally nothing.  To include an actual dollar sign $ in
  233. a SUBMIT file just precede it with another dollar sign.  For example, $$ in
  234. a SUBMIT file would be expanded into simply $ when the file is executed.
  235.  
  236.     SUBMIT files can be created in three ways.  If you wish to create a
  237. SUBMIT file consisting of a BASIC subroutine that can be merged, just DOPEN
  238. a file to disk, use CMD to set output to the file, then LIST the subroutine
  239. to disk, use PRINT# to clear the output channel, then CLOSE the file.  To
  240. create a SUBMIT file of commands, just DOPEN a file to disk, PRINT# the
  241. commands to the disk file, then CLOSE the file.  Alternately, you can
  242. create SUBMIT files with "COM.EDT", the full-screen programmer's text
  243. editor that's on this side of LOADSTAR.
  244.  
  245. "COM.PC"
  246.  
  247.     This utility is a simple programmer's calculator with 28 functions,
  248. three memories, and which can display in four radices, decimal,
  249. hexadecimal, binary, and character.  The calculator is an RPN (Reverse
  250. Polish Notation) stack-oriented calculator as opposed to the more common
  251. algebraic calculators.  You enter numbers onto a stack, then perform
  252. operations on the stack.  You enter a number by typing it then typing the
  253. RETURN or ENTER keys.  For example, typing 5.543 RETURN would place 5.543
  254. on the stack.  A number is also automatically entered when you type an
  255. operation key like * (multiplication).  For example, here's how to multiply
  256. 5 times 3. type:
  257. 5 RETURN 3 *
  258.  
  259.      Note that the * operator is entered after the numbers it operates on.
  260. This notation was invented by a Polish mathematician and is known as
  261. Reverse Polish Notation.  The two top stack positions are special since all
  262. arithmetic and logical operations are performed on one or both of these
  263. entries.  The top entry is known as the X register, and the second entry is
  264. the Y register, hereafter referred to simply as X and Y.
  265.  
  266.      When you are entering a number a solid cursor is displayed on the top
  267. stack entry, indicating input mode.  During input mode you can type DEL to
  268. delete the last character entered.  Typing RETURN terminates input mode and
  269. puts the number entered on the stack.  Typing DEL when no cursor is
  270. displayed deletes the top stack entry.  Typing RETURN when no cursor is
  271. displayed duplicates the top entry.  You can type the CLR key to clear the
  272. stack and memories.
  273.  
  274.      If an error occurs during an operation, such as OVERFLOW, DIVISION BY
  275. ZERO, etc., the error message will be displayed at the bottom of the
  276. calculator, and you must type the ESC key to clear the error message.  The
  277. functions are listed below.  In order to perform a function you must type a
  278. SHIFT key and the indicated key simultaneously.  For example, to set
  279. hexadecimal radix mode type a SHIFT key and the H key simultaneously.
  280. Setting CAPS LOCK is useful in all modes except character radix mode.
  281.  
  282. RUN STOP
  283.  
  284.     Exit the calculator.  Return to BASIC.
  285.  
  286. D  Set decimal radix.  During number entry you can enter the keys 0..9, the
  287. Decimal point ., and e or E to indicate exponentiation.  After entering e
  288. or E you may type the - sign to indicate a negative exponent.  Except for
  289. this one special case, typing - computes Y - X.
  290.  
  291. H  Set hexadecimal radix.  You can enter the keys 0..9 and a..f.
  292.  
  293. B  Set binary radix.  You can enter the keys 0 or 1 only.
  294.  
  295. C  Set character radix.  You can enter any character as a number.  In order
  296. to execute a function you must type the ESC key first.  For example to
  297. switch to hexadecimal radix type the ESC key and release it, then type a
  298. SHIFT key and the H key simultaneously.
  299.  
  300. P  Pick operation.  Copy a number to the top of the stack.  The stack
  301. entries are numbered from 0 (the top) to 7 (the bottom).  After typing P
  302. type a digit corresponding to the entry you wish to copy.
  303.  
  304. R  Roll operation.  Move a number to the top of the stack.  The stack
  305. entries are numbered from 0 (the top) to 7 (the bottom).  After typing R
  306. type a digit corresponding to the entry you wish to move.
  307.  
  308. W  Swap operation.  Swap the contents of X and Y.
  309.  
  310. F  Fetch. Copy a memory register to the top of the stack.  After typing F
  311. type a digit 0, 1, or 2 corresponding to the memory register you wish to
  312. fetch.
  313.  
  314. U  Put. Copy X to a memory register.  After typing U type a digit 0, 1, or
  315. 2 corresponding to the memory register you wish to store X to.
  316.  
  317. I  Int.  Remove the fractional part of X.
  318.  
  319. G  Negate. Change the sign of X.
  320.  
  321. A  Compute the absolute value of X.
  322.  
  323. L  Compute the natural logarithm of X.
  324.  
  325. Q  Compute the square root of X.
  326.  
  327. X  Compute the value of e^X, where e=2.71828183.
  328.  
  329. O  Compute the cosine of X.
  330.  
  331. S  Compute the sine of X.
  332.  
  333. N  Compute the tangent of X.
  334.  
  335. T  Compute the arctangent of X.
  336.  
  337. +  Compute Y + X.
  338.  
  339. -  Compute Y - X.
  340.  
  341. *  Compute Y * X.
  342.  
  343. /  Compute Y / X.
  344.  
  345. M  Modulus.  Compute the remainder of Y / X.
  346.  
  347. ^  Compute Y to the power of X.
  348.  
  349. &  Compute Y AND X.
  350.  
  351. !  Compute Y EXCLUSIVE-OR X.
  352.  
  353. {SHIFT--}  Compute Y OR X.
  354.  
  355. RR
  356.                              **** End of Text ****
  357.